
package com.google.libgdxpractice;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.GLCommon;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class ScreenGame implements Screen {

	int state;
	OrthographicCamera guiCam;
	SpriteBatch spriteBatch;
	MyWorld world;
	WorldRenderer worldRenderer;
	Game game;
	
	public ScreenGame(Game tron) {
		this.game = tron;
		guiCam = new OrthographicCamera();
		spriteBatch = new SpriteBatch();
		world = new MyWorld();
		worldRenderer = new WorldRenderer(spriteBatch, world);
	}

	@Override
	public void present(float deltaTime) {
		GLCommon gl = Gdx.gl;
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		gl.glEnable(GL10.GL_TEXTURE_2D);
		
		worldRenderer.render();
		
		guiCam.update();
		spriteBatch.setProjectionMatrix(guiCam.combined);	
		spriteBatch.enableBlending();
		spriteBatch.begin();
		spriteBatch.end();
	}
	
	@Override
	public void update(float deltaTime) {
		world.update(deltaTime);
	}
	
	@Override public void resume () {
	}

	@Override public void dispose () {

	}


	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

}